import { get, post, del, put } from "@/utils/request";
import {
  type addPlayParams,
  type playListData,
  type playListParams,
  type playListReturn,
} from "./type";

// 院内活动列表
export const playList = (data: playListParams) => {
  return get<playListParams, playListReturn>("/api/play/list", data);
};

// 院内活动添加
export const playAdd = (data: addPlayParams) => {
  return post<addPlayParams, playListData>("/api/play/add", data);
};

// 修改
export const playUpdate = (data: addPlayParams) => {
  return put<addPlayParams, playListData>("/api/play/update", data);
};

// 活动分类
export const playType = () => {
  return get<null, any>("/api/playType/list");
};

// 获取单条数据
export const playGet = (id: number) => {
  return get<null, playListData>(`/api/play/get/${id}`);
};

// 院内活动删除
export const playDel = (id: number) => {
  return del<null, null>(`/api/play/delete/${id}`);
};

// 批删
export const playDelAll = (ids: number[]) => {
  return post<number[], null>("/api/play/deleteAll", ids);
};
